package com.sheledon.demo.demo1.controller;

import com.sheledon.demo.pojo.Person;
import com.sheledon.demo.demo1.service.PersonService;
import com.sheledon.flyCat.annotation.ioc.Autowired;

import com.sheledon.flyCat.annotation.springmvc.GetMapping;
import com.sheledon.flyCat.annotation.springmvc.PathVariable;
import com.sheledon.flyCat.annotation.springmvc.RestController;

/**
 * 测试普通路由，GET，POST请求
 * 依赖的自动注入
 * @author sheledon
 */
@RestController("/person")
public class PersonController {

    @Autowired
    private PersonService personService;

    @GetMapping("/{name}")
    public Person getPerson(@PathVariable("name") String name){
        Person person = personService.getPerson(name);
        System.out.println("获得person");
        return person;
    }
}
